X-Git-Url: https://git.r.bdr.sh/rbdr/super-polarity/blobdiff_plain/74c155708d85abfc2cf227c08de4f27003015b3f..0cafec445af0a97d96feb1a1daefa1486142c73f:/Super%20Polarity/SuperPolarity.cs?ds=inline
diff --git a/Super Polarity/SuperPolarity.cs b/Super Polarity/SuperPolarity.cs
index 6689167..9311d53 100644
--- a/Super Polarity/SuperPolarity.cs
+++ b/Super Polarity/SuperPolarity.cs
@@ -7,6 +7,8 @@ using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Storage;
using Microsoft.Xna.Framework.GamerServices;
+using Microsoft.Xna.Framework.Media;
+using Microsoft.Xna.Framework.Audio;
using SuperPolarity;
#endregion
@@ -26,12 +28,16 @@ namespace SuperPolarity
Screen EntryScreen;
- SpriteFont DebugFont;
+ protected Song TitleSong;
+ protected Song GameSong;
+ protected SoundEffect GameOverSound;
public SuperPolarity()
: base()
{
graphics = new GraphicsDeviceManager(this);
+ Components.Add(new GamerServicesComponent(this));
+
graphics.PreferMultiSampling = true;
graphics.PreferredBackBufferWidth = 1280;
graphics.PreferredBackBufferHeight = 720;
@@ -43,7 +49,7 @@ namespace SuperPolarity
ActorManager.SetGame(this);
ScreenManager.SetGame(this);
- EntryScreen = (Screen)new GameScreen(this);
+ EntryScreen = (Screen)new TitleScreen(this);
}
///
@@ -60,7 +66,6 @@ namespace SuperPolarity
InputController.Bind("fullScreenToggle", HandleFullScreenToggle);
EntryScreen.Initialize();
- ScreenManager.Push(EntryScreen);
OutlierBounds = 100;
}
@@ -77,13 +82,17 @@ namespace SuperPolarity
///
protected override void LoadContent()
{
+
+ MediaPlayer.IsRepeating = true;
+ GameSong = Content.Load("Sound\\polaritytheme.wav");
+ GameOverSound = Content.Load("Sound\\gameover");
+
// Create a new SpriteBatch, which can be used to draw textures.
spriteBatch = new SpriteBatch(GraphicsDevice);
- EntryScreen.LoadContent();
+ ScreenManager.Push(EntryScreen);
- Player = new Player();
- DebugFont = Content.Load("Fonts\\SegoeUIMono14");
+ Player = new Player(this);
}
///
@@ -107,6 +116,8 @@ namespace SuperPolarity
ScreenManager.Update(gameTime);
+ Player.Update();
+
base.Update(gameTime);
}
@@ -122,13 +133,29 @@ namespace SuperPolarity
ScreenManager.Draw(spriteBatch);
- spriteBatch.DrawString(DebugFont, "Score: " + Player.Score.ToString(), new Vector2(10, 10), Color.LightGray);
- spriteBatch.DrawString(DebugFont, "Multiplier: " + Player.Multiplier.ToString(), new Vector2(10, 30), Color.LightGray);
- spriteBatch.DrawString(DebugFont, "Lives: " + Player.Lives.ToString(), new Vector2(10, 50), Color.LightGray);
-
spriteBatch.End();
base.Draw(gameTime);
}
+
+ public void PlaySong(string songName)
+ {
+ // temp stuff before media manager is in
+ if (songName == "game")
+ {
+ MediaPlayer.Play(GameSong);
+ }
+ }
+
+ public void GameOver()
+ {
+ var scoreScreen = new ScoreScreen(this);
+ scoreScreen.Initialize();
+
+ MediaPlayer.Stop();
+ GameOverSound.Play();
+ ScreenManager.Pop();
+ ScreenManager.Push(scoreScreen);
+ }
}
}